package com.yunchao.library.socket.enum

// ================== 传输类型 ==================
enum class TransportType(val code: Int) {
    HEARTBEAT(0x0000),
    INIT(0x1001),
    MESSAGE(0x1002),
    CHECK(0x1004),
    ACCESS(0x1005),
    DISPATCH(0x2002),
    EXECUTE(0x2003),
    CONFIRM(0x2004),
    METADATA(0x2005),
    COMMAND(0x2006),
    SUBMIT(0x4002),
    AUTH(0x4003),
    POWER(0x8001),
    EXCHANGE(0x8002);

    companion object {
        fun fromCode(code: Int): TransportType {
            return entries.firstOrNull { it.code == code } ?: HEARTBEAT
        }
    }
}